package com.atguigu.spring.webflux.test;

import java.util.Observable;

/**
 * @author zp
 * @version 1.0
 * @description: TODO
 * @date 2022/9/10 14:34
 */
public class ObservableDemo extends Observable {

    public static void main(String[] args) {
        ObservableDemo observable = new ObservableDemo();
        //添加消息
        observable.addObserver((o,arg)->{
            System.out.println("发生了变化");
        });

        observable.addObserver((o,arg)->{
            System.out.println("手动被观察者通知，准备改变");
        });
        observable.setChanged(); //数据变化
        observable.notifyObservers(); //通知唤醒
    }
}
